package manong.beans;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;

public class Classroom implements Cloneable, Serializable {

    private Integer id;
    private String roomName;
    private Integer roomSpace;
    private Integer roomLayer;
    private Integer roomSign;
    private Integer statu;
    private String mark;
    private static final long serialVersionUID = 1L;

    public Classroom(Integer id, String roomName, Integer roomSpace, Integer roomLayer, Integer roomSign, Integer statu, String mark) {
        this.id = id;
        this.roomName = roomName;
        this.roomSpace = roomSpace;
        this.roomLayer = roomLayer;
        this.roomSign = roomSign;
        this.statu = statu;
        this.mark = mark;
    }

    public Classroom() {
        super();
    }

    public Integer getId() {
        return id;
    }

    public Classroom withId(Integer id) {
        this.setId(id);
        return this;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getRoomName() {
        return roomName;
    }

    public Classroom withRoomName(String roomName) {
        this.setRoomName(roomName);
        return this;
    }

    public void setRoomName(String roomName) {
        this.roomName = roomName;
    }

    public Integer getRoomSpace() {
        return roomSpace;
    }

    public Classroom withRoomSpace(Integer roomSpace) {
        this.setRoomSpace(roomSpace);
        return this;
    }

    public void setRoomSpace(Integer roomSpace) {
        this.roomSpace = roomSpace;
    }

    public Integer getRoomLayer() {
        return roomLayer;
    }

    public Classroom withRoomLayer(Integer roomLayer) {
        this.setRoomLayer(roomLayer);
        return this;
    }

    public void setRoomLayer(Integer roomLayer) {
        this.roomLayer = roomLayer;
    }

    public Integer getRoomSign() {
        return roomSign;
    }

    public Classroom withRoomSign(Integer roomSign) {
        this.setRoomSign(roomSign);
        return this;
    }

    public void setRoomSign(Integer roomSign) {
        this.roomSign = roomSign;
    }

    public Integer getStatu() {
        return statu;
    }

    public Classroom withStatu(Integer statu) {
        this.setStatu(statu);
        return this;
    }

    public void setStatu(Integer statu) {
        this.statu = statu;
    }

    public String getMark() {
        return mark;
    }

    public Classroom withMark(String mark) {
        this.setMark(mark);
        return this;
    }

    public void setMark(String mark) {
        this.mark = mark;
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Classroom other = (Classroom) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getRoomName() == null ? other.getRoomName() == null : this.getRoomName().equals(other.getRoomName()))
            && (this.getRoomSpace() == null ? other.getRoomSpace() == null : this.getRoomSpace().equals(other.getRoomSpace()))
            && (this.getRoomLayer() == null ? other.getRoomLayer() == null : this.getRoomLayer().equals(other.getRoomLayer()))
            && (this.getRoomSign() == null ? other.getRoomSign() == null : this.getRoomSign().equals(other.getRoomSign()))
            && (this.getStatu() == null ? other.getStatu() == null : this.getStatu().equals(other.getStatu()))
            && (this.getMark() == null ? other.getMark() == null : this.getMark().equals(other.getMark()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getRoomName() == null) ? 0 : getRoomName().hashCode());
        result = prime * result + ((getRoomSpace() == null) ? 0 : getRoomSpace().hashCode());
        result = prime * result + ((getRoomLayer() == null) ? 0 : getRoomLayer().hashCode());
        result = prime * result + ((getRoomSign() == null) ? 0 : getRoomSign().hashCode());
        result = prime * result + ((getStatu() == null) ? 0 : getStatu().hashCode());
        result = prime * result + ((getMark() == null) ? 0 : getMark().hashCode());
        return result;
    }


    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", roomName=").append(roomName);
        sb.append(", roomSpace=").append(roomSpace);
        sb.append(", roomLayer=").append(roomLayer);
        sb.append(", roomSign=").append(roomSign);
        sb.append(", statu=").append(statu);
        sb.append(", mark=").append(mark);
        sb.append("]");
        return sb.toString();
    }

 
    @Override
    public Classroom clone() throws CloneNotSupportedException {
        return (Classroom) super.clone();
    }


    public enum Column {
        id("id", "id", "INTEGER", false),
        roomName("room_name", "roomName", "VARCHAR", false),
        roomSpace("room_space", "roomSpace", "INTEGER", false),
        roomLayer("room_layer", "roomLayer", "INTEGER", false),
        roomSign("room_sign", "roomSign", "INTEGER", false),
        statu("statu", "statu", "INTEGER", false),
        mark("mark", "mark", "VARCHAR", false);

      
        private static final String BEGINNING_DELIMITER = "`";

        private static final String ENDING_DELIMITER = "`";

   
        private final String column;

        private final boolean isColumnNameDelimited;


        private final String javaProperty;

        private final String jdbcType;

        public String value() {
            return this.column;
        }

        public String getValue() {
            return this.column;
        }

        public String getJavaProperty() {
            return this.javaProperty;
        }

        public String getJdbcType() {
            return this.jdbcType;
        }

        Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) {
            this.column = column;
            this.javaProperty = javaProperty;
            this.jdbcType = jdbcType;
            this.isColumnNameDelimited = isColumnNameDelimited;
        }


        public String desc() {
            return this.getEscapedColumnName() + " DESC";
        }


        public String asc() {
            return this.getEscapedColumnName() + " ASC";
        }


        public static Column[] excludes(Column ... excludes) {
            ArrayList<Column> columns = new ArrayList<>(Arrays.asList(Column.values()));
            if (excludes != null && excludes.length > 0) {
                columns.removeAll(new ArrayList<>(Arrays.asList(excludes)));
            }
            return columns.toArray(new Column[]{});
        }


        public String getEscapedColumnName() {
            if (this.isColumnNameDelimited) {
                return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString();
            } else {
                return this.column;
            }
        }
    }
}